package com.rtline.business.controller;

import com.rtline.business.annotation.RateLimit;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import lombok.extern.slf4j.Slf4j;

/**
 * <p>RateLimitController .
 *
 * <p>change history:
 *
 * <pre>
 * date         defect       person          comments
 * --------------------------------------------------------------------------------
 * 2025/6/5    ********     Tao Ren    create file.
 * </pre>
 *
 * @author Tao Ren
 * @date 2025/6/5 19:18
 */
@RestController
@RequestMapping("/rete/limit")
@Slf4j
public class RateLimitController {
    @GetMapping("/test")
    @RateLimit(limit = 2, period = 60, resource = "testResource", message = "Too many requests, please try again later")
    public String test() {
        return "Hello, Rate Limit!";
    }
}
